﻿using System;

using UnityEngine;

public class BaseGame : MonoBehaviour
{
	public static BaseGame nowGame = null;

	public AudioSource music = null;

	protected GameCfgData.GameCfg gameCfg = null;

	protected bool hasBegin = false;

	protected int score = 0;
	public virtual void AddScore()
	{
		score++;

		// 更新计分板
		if ( gameCfg.gameType == "0")
			gameUI.GetInstance().RefreshScore(score, gameCfg.gudian.Count);
		else
			gameUI.GetInstance().RefreshScore(score, gameCfg.gudian.Count + gameCfg.gudian2.Count);
	}


	public virtual void Pause()
	{
		Time.timeScale = 0;
		music.Pause();
	}

	public virtual void UnPause()
	{
		Time.timeScale = 1;
		music.UnPause ();
	}

	public virtual void FinishGame()
	{
		// 人不走了
		hasBegin = false;

		gameUI.GetInstance ().Finish (score);
	}

	public virtual void Init( string id)
	{
		gameCfg = DataManager.gameCfgData.GetCfg (id);
	}

	public virtual void ReInit()
	{
	}

	public virtual void CloseGame()
	{
		gameObject.SetActive (false);
	}

	public virtual void Clear()
	{
	}

	public virtual void Replay()
	{
	}

	public virtual void BeginGame()
	{
	}

	public virtual void ShowGuide(bool show)
	{
	}

}


